Merged
Conversation
…into feature/notifications
…into test/email_sender
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||
…into test/email_sender
kdsuneraavinash
approved these changes
Jan 5, 2026
app/core/tests/test_email_sender.py
Outdated
Comment on lines
63
to
66
| class ConcreteSender(EmailSender): | ||
| @override | ||
| async def send_email(self, email: Email) -> str: | ||
| return await super().send_email(email) # type: ignore |
Member
There was a problem hiding this comment.
Remove concrete sender and use the base sender
app/core/tests/test_email_sender.py
Outdated
Comment on lines
15
to
34
| @pytest.fixture | ||
| def email_factory(email_templates: tuple[Path, Path]): | ||
| html_template, text_template = email_templates | ||
|
|
||
| def _create_email( | ||
| sender: str = "test@testmail.com", | ||
| receivers: list[EmailStr] | None = None, | ||
| subject: str = "Test", | ||
| template_data: dict[str, object] | None = None, | ||
| ): | ||
| return Email( | ||
| sender=sender, | ||
| receivers=receivers or ["receiver@testemail.com"], | ||
| subject=subject, | ||
| body_html_template=html_template, | ||
| body_text_template=text_template, | ||
| template_data=template_data or {"name": "TestUser"}, | ||
| ) | ||
|
|
||
| return _create_email |
Member
There was a problem hiding this comment.
Try to use factory-boy library
Or try to use email_fixture directly
If using this fixture, rename to email_factory_fixture
app/core/tests/test_email_sender.py
Outdated
|
|
||
|
|
||
| def test_get_email_sender_raises_not_implemented_error_for_invalid_email_sender_types(settings_fixture: SettingsDep): | ||
| settings_fixture.email_sender_type = "invalid" # type: ignore |
Member
There was a problem hiding this comment.
Narrow the type ignore to the specific type check
app/conftest.py
Outdated
Comment on lines
194
to
210
| @pytest.fixture | ||
| def email_templates(tmp_path: Path) -> tuple[Path, Path]: | ||
| html_template = tmp_path / "test.mjml" | ||
| text_template = tmp_path / "test.txt" | ||
|
|
||
| _ = html_template.write_text(""" | ||
| <mjml> | ||
| <mj-body> | ||
| <mj-text>Hello {{ name}}</mj-text> | ||
| </mj-body> | ||
| </mjml> | ||
| """) | ||
|
|
||
| _ = text_template.write_text("Hello {{ name }}") | ||
|
|
||
| return html_template, text_template | ||
|
|
Member
There was a problem hiding this comment.
Move this to test_email_sender file
app/conftest.py
Outdated
Comment on lines
212
to
214
| @pytest.fixture | ||
| def fake_settings(settings_fixture: Settings) -> Settings: | ||
| return settings_fixture |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Checklist
Screenshots
Screenshots of the API documentation (swagger) or other relevant artifacts associated with this PR (if applicable).